<?php

    class groups_to_object_model extends CI_Model{

        function __construct()
        {
            parent::__construct();
        }

        function get_object_groups($type,$as_array=FALSE)
        {
            $q = "SELECT *
            FROM object_groups
            LEFT JOIN groups ON object_groups.groups_ID = groups.ID
            WHERE object_groups.object_type = '$type'
            AND groups.ID != 1
            ";

            $res = $this->db->query($q)->result_array();

            if($as_array==FALSE)
            {
                return $res;
            }
            else
            {
                $my_array = array();
                foreach ($res as $row):
                    $my_array[]=$row['groups_ID'];
                    endforeach;

                return $my_array;
            }
        }
        

    }

?>